﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using hou_elearning.Entity;
using hou_elearning.Business;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

public partial class Admin_control_ucDemo : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        testJSON();
    }
    public void testJSON()
    {
        String sJSON = "{\"PK_iDiemdanhID\":0,\"FK_iKhoahocID\":2,\"FK_iTrangslideID\":1,\"iTrangthai\":1,\"dThoidiemxem\":\"\\/Date(1338223293000)\\/\"}";
        DiemdanhEntity oDiemdanh = new DiemdanhEntity();
        oDiemdanh = JsonConvert.DeserializeObject<DiemdanhEntity>(sJSON);
        lblJSON.Text = oDiemdanh.dThoidiemxem.ToString("dd/MM/yyyy");
        //
        Int64 iRes = 0;
        oDiemdanh = JsonConvert.DeserializeObject<DiemdanhEntity>("{\"PK_iDiemdanhID\":0,\"FK_iKhoahocID\":2,\"FK_iHocvienID\":1,\"FK_iTrangslideID\":4,\"iTrangthai\":1,\"dThoidiemxem\":\"\\/Date(1338265805000)\\/\"}");
        if (DiemdanhBRL.GetByFK_iKhoahocIDAndFK_iHocvienIDAndFK_iTrangslideID(oDiemdanh.FK_iKhoahocID, oDiemdanh.FK_iHocvienID, oDiemdanh.FK_iTrangslideID).Count <= 0)
        {
            iRes = DiemdanhBRL.Add(oDiemdanh);
            lblJSON.Text = iRes + "";
        }
    }
}